package cn.edu.buaa.cnsatm.traffic_big_data_server.integrated.model;

import java.sql.ResultSet;
import java.sql.SQLException;

public class RoadStatusModel {
    String road_type;
    String block_reason;
    String block_description;
    String block_geom;
    String block_start_time;
    String block_end_time_plan;
    String block_end_time_real;
    String update_time;
    String block_title;
    public RoadStatusModel(String road_type, String block_reason, String block_description, String block_start_time, String update_time) {
        this.road_type = road_type;
        this.block_reason = block_reason;
        this.block_description = block_description;
        this.block_start_time = block_start_time;
        this.update_time = update_time;
    }

    public RoadStatusModel(String road_type, String block_reason, String block_description, String block_geom, String block_start_time, String block_end_time_plan, String block_end_time_real, String update_time) {
        this.road_type = road_type;
        if(this.road_type != null) this.road_type = "'" +this.road_type + "'";
        this.block_reason = block_reason;
        if(this.block_reason != null) this.block_reason = "'" +this.block_reason + "'";
        this.block_description = block_description;
        if(this.block_description != null) this.block_description = "'" +this.block_description + "'";
        this.block_geom = block_geom;
        //if(this.block_geom != null) this.block_geom = "'" +this.block_geom + "'";

        this.block_start_time = block_start_time;
        if(this.block_start_time != null) this.block_start_time = "'" +this.block_start_time + "'";
        this.block_end_time_plan = block_end_time_plan;
        if(this.block_end_time_plan != null) this.block_end_time_plan = "'" +this.block_end_time_plan + "'";
        this.block_end_time_real = block_end_time_real;
        if(this.block_end_time_real != null) this.block_end_time_real = "'" +this.block_end_time_real + "'";
        this.update_time = update_time;
        if(this.update_time != null) this.update_time = "'" +this.update_time + "'";
    }

    public RoadStatusModel(ResultSet resultSet) {
        /*从ResultSet里强行抓字段，抓不到就不管了*/
        try{this.road_type = resultSet.getString("road_type");}catch(SQLException e){}
        //if(this.road_type != null) this.road_type = "'" +this.road_type + "'";
        try{this.block_reason = resultSet.getString("block_reason");}catch(SQLException e){}
        try{this.block_description = resultSet.getString("block_description");}catch(SQLException e){}
        try{this.block_geom = resultSet.getString("block_geom");}catch(SQLException e){}
        try{this.block_start_time = resultSet.getString("block_start_time");}catch(SQLException e){}
        try{this.block_end_time_plan = resultSet.getString("block_end_time_plan");}catch(SQLException e){}
        try{this.block_end_time_real = resultSet.getString("block_end_time_real");}catch(SQLException e){}
        try{this.update_time = resultSet.getString("update_time");}catch(SQLException e){}
        try{this.block_title = resultSet.getString("block_title");}catch(SQLException e){}
    }
    

    public String getRoad_type() {
        return road_type;
    }

    public String getBlock_reason() {
        return block_reason;
    }

    public String getBlock_description() {
        return block_description;
    }

    public String getBlock_geom() {
        return block_geom;
    }

    public String getBlock_start_time() {
        return block_start_time;
    }

    public String getBlock_end_time_plan() {
        return block_end_time_plan;
    }

    public String getBlock_end_time_real() {
        return block_end_time_real;
    }

    public String getUpdate_time() {
        return update_time;
    }

    public String getBlock_title() {
        return block_title;
    }

    public void setBlock_title(String block_title) {
        this.block_title = "'" + block_title + "'";
    }
}
